﻿using System;

using enyo;

namespace com.RexToy
{
    public class AreaView : ConverterView
    {
        private object[] components = new object[]{ 
            new {kind= ControlKind.BasicScroller, 
                components=new object[] {
                    new {kind=ControlKind.RowGroup, 
                        components= new object[]{
				            new {name= "m2", richContent= false, kind = ControlKind.Input, onblur="blur",
                                    components=new object[]{
					                    new {className= "hint", content= enyo.g11nGlobal._L("Square Meter")}
                                    }
                            },
                            new {name= "km2", richContent= false, kind= ControlKind.Input, onblur="blur", 
                                    components= new object[]{
					                    new {className= "hint", content= enyo.g11nGlobal._L("Square Kilometer")}
				                    }
                            },
				            new {name= "mi2", richContent= false, kind= ControlKind.Input, onblur="blur", 
                                    components=new object []{
					                    new {className= "hint", content= enyo.g11nGlobal._L("Square Mile")}
				                   }
				            },
                            new {name= "ft2", richContent= false, kind= ControlKind.Input, onblur="blur", 
                                    components=new object []{
					                    new {className= "hint", content= enyo.g11nGlobal._L("Square Feet")}
				                   }
				            },
                            new {name= "rd", richContent= false, kind= ControlKind.Input, onblur="blur", 
                                    components=new object []{
					                    new {className= "hint", content= enyo.g11nGlobal._L("Square Rood")}
				                   }
				            },
                            new {name= "mu", richContent= false, kind= ControlKind.Input, onblur="blur", 
                                    components=new object []{
					                    new {className= "hint", content= enyo.g11nGlobal._L("Mu(China)")}
				                   }
				            }
			            }                    
		            }      
                }
            }
        };

        public override void Create()
        {
            this.Inherited(Arguments.Value);

            this.units = new string[] { "m2", "km2", "mi2", "ft2", "rd", "mu" };
            this.baseUnit = "m2";

            this.fomular = new object();
            this.fomular["m2->m2"] = "m2";

            this.fomular["m2->km2"] = "m2/1000000";
            this.fomular["km2->m2"] = "km2*1000000";
            this.fomular["m2->mi2"] = "m2/2589988.110336";
            this.fomular["mi2->m2"] = "mi2*2589988.110336";
            this.fomular["m2->ft2"] = "m2*10.7639104";
            this.fomular["ft2->m2"] = "ft2/10.7639104";
            this.fomular["m2->rd"] = "m2/4046.8564224";
            this.fomular["rd->m2"] = "rd*4046.8564224";
            this.fomular["m2->mu"] = "m2*3/2000";
            this.fomular["mu->m2"] = "mu*2000/3";
        }
    }
}
